package com.example.server.util;

import com.github.pagehelper.PageInfo;

import java.util.HashMap;
import java.util.Map;

public class PageUtils {
    /**
     * 将分页信息封装到统一的接口
     * @param pageInfo
     * @return
     */
    public static Map getPageResult(PageInfo<?> pageInfo) {
        Map<String,Object> map = new HashMap<>();
        map.put("total",pageInfo.getTotal());
        map.put("currentPage",pageInfo.getPageNum());
        map.put("pageSize", pageInfo.getPageSize());

        Map<String ,Object> maps = new HashMap<>();
        maps.put("pageInfo",map);
        maps.put("content",pageInfo.getList());
        return maps;
    }
}
